package com.globalwave.rule.engine.operator.impl;

import java.sql.Types;

import com.globalwave.rule.engine.operator.OperatorInf;

public class Equal implements OperatorInf {

	private int type = Types.NULL ;
	
	@Override
	public boolean calculate(Object value1, Object value2) {
		
		if (value1 == null && value2 == null) {
			return true ;
		}

		if (value1 == null) {
			return false ;
		}
		//if (value2 == null) return false ;
		
		if (type == Types.NULL) {
			return value1.equals(value2) ;
		}
				
	    return value1.equals(value2) ;
	}

	@Override
	public void setType(int type) {
		this.type = type ;
	}

}
